Creating the widget does not actually create the window
until it is realized, and consequently, the application
should not perform any GL to the window immediately after
creation. Instead the application must wait until after it
has realized the window. Alternatively, the ggggiiiinnnniiiitttt callback
may be used to indicate when the window has been created.
Upon receiving this callback, the application can perform
all GL initialization for the window, and can subsequently
perform other GL operations on it. The initialization is
discussed in more detail below.
The widget will create additional windows for overlays,
underlays, or popup planes if required, and if underlying
support is available. The remainder of this manual page
will use the term aaaauuuuxxxxiiiilllliiiiaaaarrrryyyy wwwwiiiinnnnddddoooowwwwssss to refer to these
additional windows. The main window in the normal planes
will be referred to as the nnnnoooorrrrmmmmaaaallll wwwwiiiinnnnddddoooowwww.
If an application contains more than one GL window, it must
use the GGGGLLLLXXXXwwwwiiiinnnnsssseeeetttt((((3333GGGG)))) call before doing any GL operations to
a window. This will select the appropriate window for the
operation. There are two common situations where there is
more than one GL window. One is where more than on GlxDraw
widget is used in a program. The other is where auxiliary
windows are used.
Normally, the call to GGGGLLLLXXXXwwwwiiiinnnnsssseeeetttt would be the first function
called in each callback. Callbacks in this case include not
only callbacks provided by the widget itself, but any other
callback that leads to GL activity such as a timeout or a
workproc. The call to GGGGLLLLXXXXwwwwiiiinnnnsssseeeetttt should be of the form
GLXwinset(display, call_data->window);
Using the window passed in the call_data has two purposes
over using XtWindow(3X) to obtain the window. First, it is
more efficient, since it avoids the function call. Second,
if auxiliary windows are used, it obtains the correct window
if this is an expose callback. For other callbacks it may
be necessary to use XXXXttttGGGGeeeettttVVVVaaaalllluuuueeeessss((((3333XXXX)))) to obtain the values of
GGGGllllxxxxNNNNoooovvvveeeerrrrllllaaaayyyyWWWWiiiinnnnddddoooowwww, GGGGllllxxxxNNNNuuuunnnnddddeeeerrrrllllaaaayyyyWWWWiiiinnnnddddoooowwww, or GGGGllllxxxxNNNNppppooooppppuuuuppppWWWWiiiinnnnddddoooowwww to
determine the proper parameter to GGGGLLLLXXXXwwwwiiiinnnnsssseeeetttt when using
The resources XXXXmmmmNNNNhhhhiiiigggghhhhlllliiiigggghhhhttttTTTThhhhiiiicccckkkknnnneeeessssssss and XXXXmmmmNNNNsssshhhhaaaaddddoooowwwwTTTThhhhiiiicccckkkknnnneeeessssssss
To include auxiliary windows, the following steps must be
taken:
+o Verify that there is support for the appropriate type
of auxiliary window. Not all hardware supports
overlays. Currently, the underlying GLX does not
support underlays.
+o Set the GGGGllllxxxxNNNNuuuusssseeeeOOOOvvvveeeerrrrllllaaaayyyy, GGGGllllxxxxNNNNuuuusssseeeeUUUUnnnnddddeeeerrrrllllaaaayyyy, or
GGGGllllxxxxNNNNuuuusssseeeePPPPooooppppuuuupppp resources as appropriate to TRUE.
+o Set the appropriate entries in the GGGGllllxxxxNNNNccccoooonnnnffffiiiigggg parameter
as described in GGGGLLLLXXXXggggeeeettttccccoooonnnnffffiiiigggg((((3333GGGG)))).
+o Create the widget as normal.
+o Make sure that the auxiliary colormap is installed
along with the GlxDraw colormap using
XXXXSSSSeeeettttWWWWMMMMCCCCoooolllloooorrrrmmmmaaaappppWWWWiiiinnnnddddoooowwwwssss((((3333XXXX11111111)))). (Note that the call to
XXXXSSSSeeeettttWWWWMMMMCCCCoooolllloooorrrrmmmmaaaappppWWWWiiiinnnnddddoooowwwwssss((((3333XXXX11111111)))) will usually specify three
windows in this case: the overlay window, the GlxDraw
window, and the top level window.)
+o Provide an expose callback routine for each auxiliary
used, by setting GGGGllllxxxxNNNNoooovvvveeeerrrrllllaaaayyyyEEEExxxxppppoooosssseeeeCCCCaaaallllllllbbbbaaaacccckkkk,
GGGGllllxxxxNNNNuuuunnnnddddeeeerrrrllllaaaayyyyEEEExxxxppppoooosssseeeeCCCCaaaallllllllbbbbaaaacccckkkk, or GGGGllllxxxxNNNNppppooooppppuuuuppppEEEExxxxppppoooosssseeeeCCCCaaaallllllllbbbbaaaacccckkkk.
+o Before drawing to an auxiliary window, do a
GGGGLLLLXXXXwwwwiiiinnnnsssseeeetttt((((3333GGGG)))) to that window. The window ID can be
obtained from the callback if the drawing is in
response to an expose, or by querying the
GGGGllllxxxxNNNNoooovvvveeeerrrrllllaaaayyyyWWWWiiiinnnnddddoooowwww, GGGGllllxxxxNNNNuuuunnnnddddeeeerrrrllllaaaayyyyWWWWiiiinnnnddddoooowwww or
When using the input callback to receive keyboard input, the
keycode in the event must be converted to a KeySym. Use
XXXXLLLLooooooookkkkuuuuppppKKKKeeeeyyyyssssyyyymmmm((((3333XXXX)))) or XXXXLLLLooooooookkkkuuuuppppSSSSttttrrrriiiinnnngggg((((3333XXXX)))) to do the conversion.
Keyboard input can also be dealt using translations, in
which case no such conversion is required.
GL programs will typically draw their backgrounds by using
cccclllleeeeaaaarrrr((((3333GGGG)))), ggggcccclllleeeeaaaarrrr((((3333GGGG)))), or some similar routine in a
specified color. Thus, the XtNbackground resource will have
/* Perform any necessary graphics initialization.*/
}
The Motif program need only differ by including GGGGllllxxxxMMMMDDDDrrrraaaawwww....hhhh
instead of GGGGllllxxxxDDDDrrrraaaawwww....hhhh and by creating a widget of type
GGGGllllxxxxMMMMDDDDrrrraaaawwwwWWWWiiiiddddggggeeeettttCCCCllllaaaassssssss instead of GGGGllllxxxxDDDDrrrraaaawwwwWWWWiiiiddddggggeeeettttCCCCllllaaaassssssss. As an
alternative, the Motif program could use GGGGllllxxxxCCCCrrrreeeeaaaatttteeeeMMMMDDDDrrrraaaawwww((((3333XXXX))))
instead.
WWWWAAAARRRRNNNNIIIINNNNGGGGSSSS
The GlxDraw should be used only for GL drawing. Using X
drawing to a GlxDraw is unsupported.
All color resources (e.g XXXXttttNNNNbbbbaaaacccckkkkggggrrrroooouuuunnnndddd) specify pixels in
the GlxDraw's parent's colormap. Since GL does not directly
make use of these resources, this won't normally be a
problem. However, if a program wishes to query such a color
(for example, to make a matching background in the GlxDraw
widget), it should use the parent's colormap.
Colormaps should be installed using
XXXXSSSSeeeettttWWWWMMMMCCCCoooolllloooorrrrmmmmaaaappppWWWWiiiinnnnddddoooowwwwssss((((3333XXXX11111111)))). This requests that the window
manager install the appropriate colormaps every time the
pointer enters the window. Colormaps should not be
installed with XXXXIIIInnnnssssttttaaaallllllllCCCCoooolllloooorrrrmmmmaaaapppp((((3333XXXX11111111)))).
If a GlxDraw widget is created as a child of an already
realized widget, the GlxDraw widget will be created
immediately, without giving the user an opportunity to add
the ggggiiiinnnniiiitttt callback. In such a case, initialization should
be done immediately after creating the widget rather than by
using the callback.
If the non-Motif GlxDraw widget is used in a Motif program
and keyboard traversal is attempted, the behavior is
undefined if the user traverses into the GlxDraw widget.